package com.monise.dao.DAO;

import java.sql.Date;
import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import com.monise.dao.BaseDao.GenericDao;
import com.monise.model.EntradaCaixa;

public class EntradaCaixaDAO extends GenericDao<EntradaCaixa>{
	
public List<EntradaCaixa> getEntradas(Date data){
		
		EntityManager manager = getEntityManager();
		
		manager.getTransaction().begin();
        Query query = manager.createQuery("SELECT a from EntradaCaixa a where a.dataEntrada=:data");
		query.setParameter("data",data);

		@SuppressWarnings("unchecked")
	    List<EntradaCaixa> entradas = query.getResultList();

		manager.getTransaction().commit();
		manager.close();
		
		return entradas;
	}
}
